
export class AttachmentUtil {

  static sizeString(size: number): string {
    let index = 0;
    let n = size != null ? size : 0;
    while (1) {
      if (n > 1024) {
        index++;
        n = n / 1024;
      }
      else {
        break;
      }
    }
    let unitArray = [`B`,'KB','MB',"GB"];
    return `${n.toFixed(2)}${unitArray[index]}`
  }
}